package com.lis.scf.repository;


import com.lis.scf.common.enums.CompanyType;
import com.lis.scf.entity.Role;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;

import java.util.List;
import java.util.Optional;

@Repository
public interface RoleRepository extends JpaRepository<Role, Long> {

    // 根据角色名称查询
    Optional<Role> findByRoleName(String roleName);

    // 根据企业类型查询角色
    List<Role> findByCompanyTypeOrCompanyType(CompanyType companyType, CompanyType all);

    Optional<Role> findByRoleNameAndCompanyType(String defaultRole, CompanyType companyType);
}
